TOPDIR=/u/home/ac/jnkim/bigsim/kicker
CPPFLAGS=-DAPPNAMESPACE=qmcplusplus -I${TOPDIR}/src -I.
AMPI_DIR=ampi
EMUL_DIR=emul

AMPI_CXX=/scr/workshop/charm/lapi-mpcc64/bin/ampiCC
AMPI_FLAGS= -tracemode projections ${CPPFLAGS}
AMPI_TAG=.AMPI

EMUL_CXX=/scr/workshop/charm/lapi-bigemulator-mpcc64/bin/ampiCC
EMUL_FLAGS= ${CPPFLAGS}
EMUL_TAG=.EMUL

all: fft3d_comm${AMPI_TAG} fft3d_comm${EMUL_TAG}

fft3d_comm${AMPI_TAG}: ${AMPI_DIR}/fft3d_comm.o ${AMPI_DIR}/communicator.o 
	$(AMPI_CXX) $(AMPI_FLAGS) -o fft3d_comm${AMPI_TAG} ${AMPI_DIR}/fft3d_comm.o ${AMPI_DIR}/communicator.o

${AMPI_DIR}/communicator.o: ${TOPDIR}/src/mpi/communicator.cpp
	$(AMPI_CXX) $(AMPI_FLAGS) -o ${AMPI_DIR}/communicator.o -c ${TOPDIR}/src/mpi/communicator.cpp

${AMPI_DIR}/fft3d_comm.o: ${TOPDIR}/src/fft3d/fft3d_comm.cpp
	$(AMPI_CXX) $(AMPI_FLAGS) -o ${AMPI_DIR}/fft3d_comm.o -c ${TOPDIR}/src/fft3d/fft3d_comm.cpp

fft3d_comm${EMUL_TAG}: ${EMUL_DIR}/fft3d_comm.o ${EMUL_DIR}/communicator.o 
	$(EMUL_CXX) $(EMUL_FLAGS) -o fft3d_comm${EMUL_TAG} ${EMUL_DIR}/fft3d_comm.o ${EMUL_DIR}/communicator.o

${EMUL_DIR}/communicator.o: ${TOPDIR}/src/mpi/communicator.cpp
	$(EMUL_CXX) $(EMUL_FLAGS) -o ${EMUL_DIR}/communicator.o -c ${TOPDIR}/src/mpi/communicator.cpp

${EMUL_DIR}/fft3d_comm.o: ${TOPDIR}/src/fft3d/fft3d_comm.cpp
	$(EMUL_CXX) $(EMUL_FLAGS) -o ${EMUL_DIR}/fft3d_comm.o -c ${TOPDIR}/src/fft3d/fft3d_comm.cpp

#jacobi3d.AMPI: jacobi3d.C
#	/scr/workshop/charm/lapi-mpcc64/bin/ampiCC -o jacobi3d.AMPI jacobi3d.C -tracemode projections
#
#jacobi3d.EMUL: jacobi3d.C
#	/scr/workshop/charm/lapi-bigemulator-mpcc64/bin/ampiCC -o jacobi3d.EMUL jacobi3d.C 
#
clean:
	rm -rf ${AMPI_DIR}/* ${EMUL_DIR}/*

